package com.sl.core.domain.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

import java.text.SimpleDateFormat;
import java.util.Date;

@Getter
@Setter
public class TransformationInfo {

    private String name;

    private String description;

    @JsonProperty("trans_type")
    private String transType;

    private String directory;

    private String parameters;

    @JsonProperty("size_rowset")
    private String sizeRowset;

    @JsonProperty("sleep_time_empty")
    private String sleepTimeEmpty;

    @JsonProperty("sleep_time_full")
    private String sleepTimeFull;

    @JsonProperty("unique_connections")
    private String uniqueConnections;

    @JsonProperty("feedback_shown")
    private String feedbackShown;


    @JsonProperty("feedback_size")
    private String feedbackSize;

    @JsonProperty("using_thread_priorities")
    private String usingThreadPriorities;

    @JsonProperty("capture_step_performance")
    private String captureStepPerformance;

    @JsonProperty("step_performance_capturing_delay")
    private String stepPerformanceCapturingDelay;

    @JsonProperty("step_performance_capturing_size_limit")

    private String stepPerformanceCapturingSizeLimit;

    private String dependencies;

    private String partitionschemas;

    private String slaveservers;

    private String clusterschemas;

    @JsonProperty("created_user")
    private String createdUser;

    @JsonProperty("created_date")
    private String createdDate;

    @JsonProperty("modified_user")
    private String modifiedUser;

    @JsonProperty("modified_date")
    private String modifiedDate;


    @JsonProperty("is_key_private")
    private String isKeyPrivate;

    private TransformationInfoLog log;

    public static TransformationInfo basic(String name, String description, String transType) {
        TransformationInfo transformationInfo = new TransformationInfo();
        transformationInfo.setName(name);
        transformationInfo.setDescription(description);
        transformationInfo.setTransType(transType);
        transformationInfo.setDirectory("/");
        transformationInfo.setParameters("");
        transformationInfo.setSizeRowset("10000");
        transformationInfo.setSleepTimeEmpty("50");
        transformationInfo.setSleepTimeFull("50");
        transformationInfo.setUniqueConnections("N");
        transformationInfo.setFeedbackShown("Y");
        transformationInfo.setFeedbackSize("50000");
        transformationInfo.setUsingThreadPriorities("Y");
        transformationInfo.setCaptureStepPerformance("N");
        transformationInfo.setStepPerformanceCapturingDelay("1000");
        transformationInfo.setStepPerformanceCapturingSizeLimit("100");
        transformationInfo.setDependencies("");
        transformationInfo.setPartitionschemas("");
        transformationInfo.setSlaveservers("");
        transformationInfo.setClusterschemas("");
        transformationInfo.setCreatedUser("-");
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS");
        String format = simpleDateFormat.format(date);
        transformationInfo.setCreatedDate(format);
        transformationInfo.setModifiedUser("-");
        transformationInfo.setModifiedDate(format);
        transformationInfo.setIsKeyPrivate("N");
        TransformationInfoLog basic = TransformationInfoLog.basic();
        transformationInfo.setLog(basic);
        return transformationInfo;
    }
}
